﻿//JumbotCms_4.1 Final
using System;
using System.Web;
using System.Data;
using Jumbot.Common;
using JumbotCms.Common;
namespace JumbotCms.WebFile.Writer
{
    public partial class _apply_ajax : JumbotCms.API.UserCenter
    {
        private string _operType = string.Empty;
        private string _response = string.Empty;

        protected void Page_Load(object sender, EventArgs e)

        {
            if (!CheckFormUrl())
            {
                Response.Write("提交有误");
                Response.End();
            }

            this._operType = q("oper");
            switch (this._operType)
            {
                case "checkapply":
                    ajaxCheckApply();
                    break;
                default:
                    DefaultResponse();
                    break;
            }
            Response.Write(this._response);
        }
        private void DefaultResponse()
        {
            User_Load("", "json");
        }
        private void ajaxCheckApply()
        {
            User_Load("", "json");
            doh.Reset();
            doh.ConditionExpress = "UserId=@userid and applytype=1 and checked=0";
            doh.AddConditionParameter("@userid", UserId);
            if (doh.Exist("jcms_normal_user_apply"))
                this._response = JsonResult(0, "不可申请");
            else
                this._response = JsonResult(1, "可以申请");
        }
    }
}
